import axios from 'axios';
import {API_NEW_VERSION} from '../api';

export const getAllChargingRules = params => {
  return axios.get(API_NEW_VERSION + 'charging-rules', {params: params});
};

export const createChargingRule = params => {
  return axios.post(API_NEW_VERSION + 'charging-rules', params);
};

export const updateChargingRule = params => {
  return axios.put(API_NEW_VERSION + 'charging-rules', params);
};

export const getChargingRule = id => {
  return axios.get(API_NEW_VERSION + 'charging-rules/' + id);
};

export const deleteChargingRule = id => {
  return axios.delete(API_NEW_VERSION + 'charging-rules/' + id);
};

export const estimatePrice = (id, params) => {
  return axios.get(API_NEW_VERSION + 'charging-rules/' + id + '/estimate', {params: params});
};

export const generateFreight = id => {
  return axios.post(API_NEW_VERSION + 'charging-rules/' + id + '/generate');
};
